import { serviceApiPrefix } from "@/common/serviceConfig";
import { appFetch } from "@/utils/tools";


export const getMenuPaginationApi = (body: any) => appFetch(
  `${serviceApiPrefix}/menus/getMenusPagination`,
  {
    method: 'post',
    body: JSON.stringify(body)
  }
)

export const getAllMenusApi = (body?: any) => appFetch(
  `${serviceApiPrefix}/menus/getAllMenusByCondition`,
  {
    method: 'post',
    body: JSON.stringify(body),
  }
)

export const addMenuApi = (body: any) => appFetch(
  `${serviceApiPrefix}/menus/addMenu`,
  {
    method: 'put',
    body: JSON.stringify(body)
  }
)

export const updateMenuApi = (_id: string, body: any) => appFetch(
  `${serviceApiPrefix}/menus/updateMenu/${_id}`,
  {
    method: 'put',
    body: JSON.stringify(body)
  }
)

export const deleteMenuApi = (ids: string[]) => appFetch(
  `${serviceApiPrefix}/menus/deleteMenus`,
  {
    method: 'delete',
    body: JSON.stringify({
      ids
    })
  }
)